package dao;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import vo.Product;
import vo.Producttype;
import vo.Spec;

/**
 * @author bohan
 * @create 2017年5月4日
 */
public class ProductDaoImpl extends BaseDaoImpl<Product> implements ProductDao{
	public Product getSpec(Product p){
		String sql = "select * from spec where productNo='"+p.getProductNo()+"'";
		List list = new ArrayList();
		list = selectBySql(sql);
		for(int i = 0;i<list.size();i++){
			p.getSpecs().add(list.get(i));
		}
		return p;
		}
	
	public Product getByNo(String no){
		String hql = "from Product where productNo='"+no+"'";
		List<Product> list = new ArrayList<Product>();
		list = select(hql);
		return list.get(0);
	}
 
}
